<?php
namespace app\api\controller;
use app\api\model\Agency;
use think\Controller;

class Agent extends Controller{
    public function uploadmessage(){
        $data = [];
        $data['shop'] = input('shop');
        $data['name'] = input('name');
        $data['iphone'] = input('iphone');
        $agent = new Agency;
        $results = $agent->uploadmessage($data);
        if($results){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10032','信息接收失败');
        }
    }
    public function uploadonce(){
        $agent = new Agency;
        $id = input('idd');
        $idcardfront = request()->file('idcardfront');
        $results = $agent->upload($id,$idcardfront,'idcardfront');
        if($results==1){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10027','第一张上传失败');
        }
    }
    public function uploadsecond(){
        $agent = new Agency;
        $id = input('idd');
        $idcardreverse = request()->file('idcardreverse');
        $results = $agent->upload($id,$idcardreverse,'idcardreverse');
        if($results==1){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10028','第二张上传失败');
        }
    }
    public function uploadthird(){
        $agent = new Agency;
        $id = input('idd');
        $businesslicense = request()->file('businesslicense');
        $results = $agent->upload($id,$businesslicense,'businesslicense');
        if($results==1){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10029','第三张上传失败');
        }
    }
    public function uploadfourtha(){
        $agent = new Agency;
        $id = input('idd');
        $storefronta = request()->file('storefronta');
        $results = $agent->upload($id,$storefronta,'storefronta');
        if($results==1){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10030','第四张上传失败');
        }
    }
    public function uploadfourthb(){
        $agent = new Agency;
        $id = input('idd');
        $storefrontb = request()->file('storefrontb');
        $results = $agent->upload($id,$storefrontb,'storefrontb');
        if($results==1){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10030','第五张上传失败');
        }
    }
    //代理商返利明细
    public function pushwater(){
        $id = input('id');
        $agent = new Agency;
        $data = null;
        $results = $agent->pushwater($id,$data);
        if($results){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10033','无返利信息');
        }
    }
    //推广明细
    public function recommend(){
        $id = input('id');
        $agent = new Agency;
        $data = null;
        $results = $agent->recommend($id,$data);
        if($results){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10034','无推广信息');
        }
    }
    //订单明细
    public function indentwater(){
        $id = input('id');
        $agent = new Agency;
        $data = null;
        $results = $agent->indentwater($id,$data);
        if($results){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10035','无订单信息');
        }
    }
    //收益明细
    public function earnings(){
        $id = input('id');
        $agent = new Agency;
        $data = null;
        $results = $agent->earnings($id,$data);
        if($results){
            AjaxReturn('1','成功',['results'=>$results]);
        }else{
            AjaxReturn('10036','无收益信息');
        }
    }
}